package org.iteam.xlz.core.service.message;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.iteam.db.BaseService;
import org.iteam.xlz.core.entity.messages.MessagesUser;

public class MessageUserService extends BaseService<MessagesUser>{
	static MessageUserService instance;
	private MessageUserService(){}
	
	public static MessageUserService getInstance(){
		if(null==instance){
			instance=new MessageUserService();
		}
		return instance;
	}	
	
	public List<MessagesUser> getAll(){
		try {
			return super.query("select * from messagesuser");
		} catch (SQLException e) {
			e.printStackTrace();
			return new ArrayList<MessagesUser>();
		}
	}
	
	public boolean setIsRead(String muid){
		try {
			return super.updates("update messagesuser set isread=0 where mui=?",muid)==1;
		} catch (SQLException e) {
			e.printStackTrace();
			return false;
		}
	}
}
